<?php
session_start ();
include ('config/bd.php');
include ('config/function.php');
$captcha = rand ( 1000, 9999 );
$_SESSION['captcha'] = $captcha;
//echo $_SESSION['captcha'];

/*
 * $connect = connexion(SQLHOST,SQLUSER,SQLPASS,SQLDB);
 * $req = 'SELECT from ....';
 * $result = extraire($connect, $req);
 * mysql_close($connect);
 */

?>
<!doctype html>
<html>
<head>
<title>Extranet EPSI</title>
<link rel="stylesheet" href="style/main.css" />
<link rel="stylesheet" href="style/formulaire.css" />
<link rel="stylesheet" href="style/media.css" />
<link rel="stylesheet" href="style/simplePagination.css" type="text/css" />
<script type="text/javascript" src="js/view.js"></script>
<script type="text/javascript" src="js/calendar.js"></script>
<script type="text/javascript" src="js/imprimer.js"></script>
<script type="text/javascript" src="js/select.js"></script>
<script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="js/jquery.simplePagination.js"></script>


<meta name="viewport" content="initial-scale=1, maximum-scale=1" />
</head>
<body>

	<div id="header">

		<div class="inner">
			<a href="index.php"><img src="images/epsi_extranet.png"
				alt="Extranet" /></a>
		</div>
	</div>

	<div id="pageBody">

		<div id="nav">
			<ul>
				<?php 
				if (!isset($_SESSION['login'])){
					echo '<li><a href="index.php">Connexion</a></li>';
				}else{
					echo '<li><a href="index.php?module=seDeconnecte">D&eacute;connexion</a></li>';
				}
				if (isset ( $_SESSION ['rang'] )) {
					echo '<li><a href="index.php?module=consultation">Consultation</a></li>';
					if ($_SESSION ['rang'] == 2) {
						echo '<li><a href="index.php?module=administration">Administration</a></li>';
					}
				}
				?>
			</ul>
		</div>

		<div id="content">
			<div class="inner">
	<?php
	if (isset ( $_GET ['module'] ) && $_GET ['module'] == "forgetpassword") {
			include ("modules/forgetpassword.php");
		} 
		
		
		
		
	if(isset($_GET['connection'])){
		if(isset($_POST['login'])){
			$login = $_POST ['login'];
			$pass = $_POST ['pass'];
		} else {
			$login = "";
			$pass = "";
		}
		include ("modules/seConnecte.php");
	}
	
	
	
	
	if (isset($_SESSION['loged']) && $_SESSION['loged'])
	{
		//echo 'if';
		if (isset ( $_GET ['module'] ) && preg_match ( "!^[a-zA-Z0-9_]{1,}$!", $_GET ['module'] )) {
			if (file_exists ( "modules/" . $_GET ['module'] . ".php" )) {
				include ("modules/" . $_GET ['module'] . ".php");
			} else {
				include ("modules/accueil.php");
			}
		} else {
			include ("modules/accueil.php");
		}
	} else {
		//echo 'else';
		include ("modules/login.php");
	}
	?>

      </div>
		</div>


	</div>

	<div id="footer">

		<div class="inner">Extranet EPSI</div>
	</div>


</body>
</html>

